package com.flyduck.system.vo.dictType.trans;


import cn.hutool.core.bean.BeanUtil;
import com.flyduck.system.entity.SysDictTypeEntity;
import com.flyduck.system.vo.dictData.SysDictDataReqVO;
import com.flyduck.system.vo.dictType.SysDictTypeAddReqVO;
import com.google.common.base.Function;

import java.util.List;


/**
 * @program: flyduck-platform
 * @description:
 * @author: flyduck
 * @create: 2021-02-01 12:42
 **/
public class SysDictTypeAddReqVOToSysDictTypeEntity implements Function<SysDictTypeAddReqVO, SysDictTypeEntity> {
    @Override
    public SysDictTypeEntity apply(SysDictTypeAddReqVO reqVO) {
        SysDictTypeEntity entity = new SysDictTypeEntity();
        BeanUtil.copyProperties(reqVO,entity);
        List<SysDictDataReqVO> dictDataList = reqVO.getDictDataList();
        for (SysDictDataReqVO sysDictDataReqVO : dictDataList) {
            sysDictDataReqVO.setDictKey(reqVO.getDictKey());
        }
        return entity;
    }

}
